package jalus;

import java.io.File;
import java.io.IOException;

import freemarker.template.Configuration;
import freemarker.template.DefaultObjectWrapper;
/**
 * freemarker configuration
 * @author dongliu
 *
 */
public class FMConfigureFactory {

	private static Configuration instance = null;
	private static void createInstance() {
		instance = new Configuration();
		try {
			instance.setDirectoryForTemplateLoading(new File("WEB-INF/templates"));
		} catch (IOException e) {
			e.printStackTrace();
		}
		instance.setObjectWrapper(new DefaultObjectWrapper());
		instance.setDefaultEncoding("UTF-8");

	}
	public static Configuration getFMConfigure(){
		if(instance == null){
			createInstance();
		}
		return instance;
	}
}
